export default{
    myDate(value,type = 0){
        var time = new Date(value * 1000);
        var year = time.getFullYear();
        var month = time.getMonth();
        var date = time.getDate();
        var hour = time.getHours();
        var minte = time.getMinutes();
        var second = time.getSeconds();
        month = month < 10 ? "0" + month :month;
        date = date < 10 ? "0" + date :date;
        hour = hour < 10 ? "0" + hour : hour;
        minte = minte < 10 ? "0" + minte :minte;
        second = second < 10 ? "0" + second : second;

        var arr = [
            year + "-" + month + "-" + date,
            year + "-" + month + "-" + date + " " + hour + ":" + minte + ":" + second,
            year + "年" + month + "月" + date,
            year + "年" + month + "月" + date + " " + hour + ":" + minte + ":" + second,
            hour + ":" + minte + ":" + second
        ]
        return arr[type];
    },
    getStrLen(str,len){
        if (str.length > len) {
            return str.substr(0,len) + "..."
        } else {
            return str
        }
    }
}